﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assets.Scripts.Pooling
{
    public interface IPooling<E>
    {
        /// <summary>
        /// 获取一个对象
        /// </summary>
        /// <returns></returns>
        E GetSpawn();
        /// <summary>
        /// 回收这个对象
        /// </summary>
        /// <param name="e"></param>
        void RecycelSpawn(E e);
        /// <summary>
        /// 回收所有对象
        /// </summary>
        void RecycleAllSpawn();

        /// <summary>
        /// 清空池子
        /// </summary>
        void EmptyPooling();
    }

    public interface IPooling<EKey, EValue>
    {
        /// <summary>
        /// 获取一个对象
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        EValue GetSpawn(EKey type);
        /// <summary>
        /// 回收这个对象
        /// </summary>
        /// <param name="type"></param>
        /// <param name="e"></param>
        void RecycelSpawn(EValue e);
        /// <summary>
        /// 回收所有组的所有对象
        /// </summary>
        void RecycleAllSpawn();
        /// <summary>
        /// 回收这个组的所有
        /// </summary>
        /// <param name="type"></param>
        void RecycleAllSpawn(EKey type);
        /// <summary>
        /// 清空池子
        /// </summary>
        void EmptyPooling();
    }
}
